<?php
require_once('../proj/classes/Student.php');

$student = new Student;
?>

<div id="content">
<h2>Reserved List</h2>
<table border=1>    
    <tr>
        <th>Last Name</th>
        <th>First Name</th>
        <th>Middle Initial</th>
        <th>Gender</th>
        <th>Date/Time</th>
        <th>Action</th>
    </tr>
    
    <?php
     
    $ctr = 0;
    $student_rec = $student->getStudent();
    
    if($student_rec != 0){
        for($x=0;$x<count($student_rec);$x++){
            echo "<tr>";
            echo "<td>".$student_rec[$x]['lname']."</td>";
            echo "<td>".$student_rec[$x]['fname']."</td>";
            echo "<td>".$student_rec[$x]['mi']."</td>";
            echo "<td>".$student_rec[$x]['gender']."</td>";
            echo "<td>".$student_rec[$x]['time']."</td>";
            echo '<td><a href="../proj/include/admin/UpdateStudentForm.php?id='.$student_rec[$x]['id']
                        .'&fname='.$student_rec[$x]['fname']
                        .'&lname='.$student_rec[$x]['lname']
                        .'&mi='.$student_rec[$x]['mi']
                        .'&gender='.$student_rec[$x]['gender']
                        .'">Update</a> | <a href="../proj/include/admin/DeleteStudent.php?stud_id='.$student_rec[$x]['id'].'">Done</a></td>';
                        
            echo "</tr>";
            $ctr+=1;
        }
    }
    ?>
    <tr>
        <tr>
        <td>Total</td>
        <td colspan=4><?php echo $ctr ?></td>
        <td><a href="../proj/include/admin/DeleteAllStudent.php">Delete All</a></td>
        </tr>
    </tr>
     
</table>
</div>